package cc.orange.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.GridLayoutManager;
import cc.orange.R;
import cc.orange.entity.MsgInfosVideoEntity;
import demo.smart.access.xutlis.util.ZXScreenUtil;


/**
 * Created by CM on 2022/10/25.
 */

public class Discover2Adapter extends BaseQuickAdapter<MsgInfosVideoEntity.Data, BaseViewHolder> {
    private int width;
    public Discover2Adapter(@Nullable List<MsgInfosVideoEntity.Data> data) {
        super(R.layout.item_discove2, data);
        width = ZXScreenUtil.getScreenWidth() / 2 - 100;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MsgInfosVideoEntity.Data item) {
        CardView item_disc2_rel1 = helper.getView(R.id.item_disc2_rel1);//布局
        ImageView item_disc2_img = helper.getView(R.id.item_disc2_img);//图片
        TextView disc2_frag_text4 = helper.getView(R.id.disc2_frag_text4);//内容
        GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) item_disc2_rel1.getLayoutParams();
        layoutParams.height  = (int)(width * 1.9);
        item_disc2_rel1.setLayoutParams(layoutParams);
        Glide.with(mContext).load(item.getSocVideo().getImage())
                .into(item_disc2_img);
        disc2_frag_text4.setText(item.getWomanName());
    }

}
